package com.buanalintas.sandals.pos.franchise;

import com.buanalintas.bynga.Field;
import com.buanalintas.bynga.Page;
import com.buanalintas.sandals.pos.entities.PosMasterFranchise;

public class Franchise extends Page{
    private Field franchiseId;
    private Field franchiseCode;
    private Field franchiseName;
    private Field franchiseAddress;
    private Field franchisePhone;
    private Field franchiseContact;

    public Franchise() {
        setTheClass(PosMasterFranchise.class);

        franchiseId = new Field();
        franchiseId.setName("franchiseId");
        franchiseId.setCaption("id");
        franchiseId.setListProperties(" align=\"right\" width=\"5%\" nowrap");
        franchiseId.setInputProperties(" size=\"20\"");
        getFields().add(franchiseId);

        franchiseCode = new Field();
        franchiseCode.setName("franchiseCode");
        franchiseCode.setCaption("code");
        franchiseCode.setListProperties(" align=\"left\" width=\"14%\" nowrap");
        franchiseCode.setInputProperties(" size=\"30\"");
        franchiseCode.setRequired(true);
        getFields().add(franchiseCode);

        franchiseName = new Field();
        franchiseName.setName("franchiseName");
        franchiseName.setCaption("name");
        franchiseName.setListProperties(" align=\"left\" width=\"26%\" nowrap");
        franchiseName.setInputProperties(" size=\"30\"");
        franchiseName.setRequired(true);
        getFields().add(franchiseName);

        franchiseAddress = new Field();
        franchiseAddress.setName("franchiseAddress");
        franchiseAddress.setCaption("address");
        franchiseAddress.setListProperties(" align=\"left\" width=\"25%\" nowrap");
        franchiseAddress.setInputProperties(" size=\"30\"");
        franchiseAddress.setRequired(true);
        getFields().add(franchiseAddress);

        franchisePhone = new Field();
        franchisePhone.setName("franchisePhone");
        franchisePhone.setCaption("phone");
        franchisePhone.setListProperties(" align=\"center\" width=\"15%\" nowrap");
        franchisePhone.setInputProperties(" size=\"30\"");
        franchisePhone.setRequired(true);
        getFields().add(franchisePhone);

        franchiseContact = new Field();
        franchiseContact.setName("franchiseContact");
        franchiseContact.setCaption("contact");
        franchiseContact.setListProperties(" align=\"center\" width=\"15%\" nowrap");
        franchiseContact.setInputProperties(" size=\"30\"");
        franchiseContact.setRequired(true);
        getFields().add(franchiseContact);

        fillFields();

        getFieldsUnique().add(new Field[]{franchiseName});
        getFieldsAdd().remove(franchiseId);
        getFieldsEdit().remove(franchiseId);
        getFieldsList().remove(franchiseId);

        getController().setOrder(franchiseCode);
        getController().setOrder(franchiseName);
        getController().setOrder(franchiseAddress);
        getController().setOrder(franchisePhone);
        getController().setOrder(franchiseContact);
    } 
}
